package cn.com.chifeng.androidfilemanager;

import android.app.AlertDialog;
import android.app.Dialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;

import cn.com.chifeng.androidfilemanager.service.DownloadAppService;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        show();
    }
    private void show(){

        AlertDialog.Builder buile = new AlertDialog.Builder(MainActivity.this).setTitle("提示").setMessage("检查到版本更新").setPositiveButton("确定", new DialogInterface.OnClickListener() {

            @Override
            public void onClick(DialogInterface arg0, int arg1) {
                Intent it = new Intent(MainActivity.this, DownloadAppService.class);
                it.putExtra(DownloadAppService.SERVICRINTENTURL, "");
                it.putExtra(DownloadAppService.SERVACESHARENAME, 0);
                startService(it);
            }
        }).setNegativeButton("取消", null);
        Dialog dialog = buile.create();
        if (!dialog.isShowing()) {
            dialog.show();
        }
    }
}
